package p.sglmsn.top.ext.wx.enums;

import lombok.Getter;
import p.sglmsn.top.ext.wx.entity.ComeBack;
import p.sglmsn.top.ext.wx.iface.MethodInterface;
import p.sglmsn.top.ext.wx.wxext.http.HttpUtil;
import p.sglmsn.top.ext.wx.wxext.http.SendDto;

/**
 * 接口枚举
 * {@link MethodEnum}
 *
 * @author sglmsn
 * @date 2021/01/03
 */
@Deprecated
public enum InterfaceEnumeration {


    启动微信(200, (sendDto) -> HttpUtil.send(new SendDto().setMethod("run").setPid(-1).setPath(HttpUtil.path))),

    切换二维码(200, sendDto -> HttpUtil.send(sendDto.setMethod("gotoQr"))),
    得到登录信息(sendDto -> HttpUtil.send(sendDto.setMethod("getInfo"))),

    ;
    @Getter
    private final MethodInterface anInterface;
    @Getter
    private Object type;
    @Getter
    private String name;

    InterfaceEnumeration(Object type, String name, MethodInterface anInterface) {
        this.type = type;
        this.name = name;
        this.anInterface = anInterface;
    }

    InterfaceEnumeration(MethodInterface anInterface) {
        this.anInterface = anInterface;
    }

    InterfaceEnumeration(Object type, MethodInterface anInterface) {
        this.type = type;
        this.anInterface = anInterface;
    }

    public ComeBack exec(SendDto dto) {
        return getAnInterface().exec(dto);
    }
}
